



package heimaTest;
import java.util.Scanner;
import java.util.Random;
  public class Demo1 {

    public static void main(String[] args) {

        Random r = new Random();
        Scanner sc = new Scanner(System.in);
        int randomNum = r.nextInt(100) + 1;


        while (true) {
            System.out.println("请输入数据");
            int num = sc.nextInt();
            if (num > randomNum) {
                System.out.println("猜大了");
            } else if (num < randomNum) {
                System.out.println("猜小了");
            } else {
                System.out.println("猜对了");
                break;
            }

        }
    }
}